<template>
  <van-field
    :model-value="content"
    placeholder="请输入"
    @update:model-value="handleUpdate"
    :right-icon="rightIcon"
    @click="rightIcon = 'warning-o'"
    @click-right-icon="handleClick"
  />
</template>
<script setup lang="ts">
import { ref, toRef } from 'vue'
import { debounce } from '@/utils/tools'
// 运行时
const emit = defineEmits(['update', 'delete'])
const props = defineProps<{
  content: string
}>()
const rightIcon = ref('')
const handleUpdate = debounce((v) => emit('update', v), 1000)

const handleClick = () => {
  rightIcon.value = ''
  emit('delete')
}
// const title = toRef(props, 'content')
</script>
